package com.atguigu.gulimall.product.entity;

import com.atguigu.common.valid.AddGroup;
import com.atguigu.common.valid.ListValue;
import com.atguigu.common.valid.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import lombok.Data;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;

/**
 * 品牌
 * 
 * @author hou
 * @email hou@gmail.com
 * @date 2021-08-21 15:01:50
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@NotNull(message = "修改必须携带品牌id",groups = {UpdateGroup.class})
	@Null(message = "新增不能携带品牌id",groups = {AddGroup.class})
	@TableId
	private Long brandId;

	@NotBlank(message = "品牌名称不能为空",groups = {AddGroup.class})
	private String name;

	@NotBlank(message = "logo地址不能为空",groups = {AddGroup.class})
	@URL(message = "logo必须是一个合法的url",groups = {AddGroup.class,UpdateGroup.class})
	private String logo;

	private String descript;

	@ListValue(vals = {0,1},groups = AddGroup.class) //当新增时携带了showStatus字段
	private Integer showStatus;

	@NotNull(message = "新增时首字母不能为空",groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是一个字母")
	private String firstLetter;

	private Integer sort;

}
